#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/6/3 3:03 下午
# @Author : admin
# @Software: PyCharm
# @File: sync_db.py

from models.Users import Users,UserProjectRelation
from models.basemodel import _mdb
from models.check.PropertyInfo import PropertyInfo
from models.check.PropertyStructure import PropertyStructure
from models.check.Roof import Roof
from models.check.ExteriorWall import ExteriorWall
from models.check.WaterCurrentSupply import WaterCurrentSupply, ElectricityCurrentSupply, SewageCurrentSupply
from models.check.FasWarmSupply import FasWarmSupply
from models.check.PropertyAssetDetail import PropertyAssetDetail
from models.check.SpecialNote import SpecialNote
from models.check.Surrounding import Surrounding
from models.check.ExteralProject import ExteralProject
from models.project.Project import Project, ProjectInfo, \
    ProjectTemplate, TemplateType, ProjectShowUser, ProjectHistory, ProjectEnginner, FasWarmRoom, ProjectConstructionUnit
from models.project.ProjectFile import ProjectFile, ProjectPic, ProjectReport
from models.rectify.Rectify import Rectify, Floor, Storey, Room,RectifyHistory
from models.Organization import Organization, OrganizationUserRelation
from models.check.CompletionAcceptance import CompletionAcceptance
from models.Supplier import Supplier, Category, TopCategory, SupplyProductType, ProjectStandard
from models.Message import Message, MsgItem
from models.role.Role import Permission, UserPermission, PermissionGroup
from models.Areas import Areas
from models.check.ProjectFileCategory import ProjectFileCategory
from models.inspection.Inspect import Inspect, InspectSetTimeRecord



tables = [Inspect]
_mdb.drop_tables(tables)

_mdb.drop_tables(tables)
_mdb.create_tables(tables)
_mdb.commit()

# def init_project():
#     proj = Project()
#     proj.save()
#     user_pro = UserProjectRelation()
#     user_pro.project_id=proj.id
#     user_pro.user_id=1
#     user_pro.save()
#     for i in [1,2]:
#         org_re = OrganizationUserRelation()
#         org_re.org_id = i
#         org_re.user_id = 1
#         org_re.save()
#
# init_project()